<template>
  <div>
    <subject />
    <!-- 题目 -->
    <subjectComent
      :details="details"
      :content="content"
      @getQuestion="getQuestion"
    />
    <!-- 答题卡/ -->
    <answerSheet @getQuestion="getQuestion" />
  </div>
</template>

<script>
import { questionDetail } from '@/api/api'
import subject from './subjectIndex'
import subjectComent from './subject-content'
import answerSheet from './answer-sheet'
export default {
  components: {
    subjectComent,
    answerSheet,
    subject
  },
  data () {
    return {
      content: {},
      details: []
    }
  },
  created () {
    // 父子
    this.content = this.$route.params
    // bus.$emit('getContent', this.content)
  },
  methods: {
    // 获取详情
    async getQuestion (id) {
      const res = await questionDetail(id)
      // 父子
      this.details = res.data
      this.$set(this.details, 'id', id)
      // console.log(res)
    }
  }
}
</script>

<style></style>
